<? if(!defined('IN_TIPASK')) exit('Access Denied'); include template('header'); ?>
<div class="box">
    <div class="box_left">
        <div class="box_left_nav font_gray">
    → <a href="<?=SITE_URL?>"><?=$setting['site_name']?></a>
            
<? if(is_array($navlist)) { foreach($navlist as $nav) { ?>
            &gt; <a href="<?=SITE_URL?>?c-<?=$nav['id']?>.html"><?=$nav['name']?></a>
            
<? } } ?>
        </div>
        <!--左栏 问题 开始-->
        <div class="ask_box">
            <div class="boxtop2_title box_okask_top">
                <strong>已解决</strong>
            </div>
            <div class="ask_box_sub">
                <div class="ask_left">
                <? if($question['hidden']) { ?>                	<img src="<?=SITE_URL?>css/default/avatar.gif"  alt="<?=$question['author']?>" width="51" height="51"><br>匿名
                    <? } else { ?>                    <a href="<?=SITE_URL?>?u-<?=$question['authorid']?>.html" target="_blank"><img src="<?=$question['author_avartar']?>"  alt="<?=$question['author']?>" width="51" height="51"></a><br>
                    <a href="<?=SITE_URL?>?u-<?=$question['authorid']?>.html" target="_blank" title="<?=$question['author']?>"><?=$question['author']?></a>
                    <? } ?>                </div>
                <div class="ask_right">
                    <strong id="question_title"><?=$question['title']?></strong>
                    <div class="clear"></div>
                    <p style="word-wrap: break-word; overflow: hidden;" class="ask_sub_description"><?=$question['description']?></p><br />
                    <? if($supplylist) { ?>                    <div>
                        
<? if(is_array($supplylist)) { foreach($supplylist as $supply) { ?>
                        <span class="font_gray">问题补充  <?=$supply['format_time']?></span>
                        <p style="word-wrap: break-word; overflow: hidden;"><?=$supply['content']?></p>
                        
<? } } ?>
                    </div>
                    <? } ?>                    <span class="font_gray">悬赏分:<span class="wy_money"><?=$question['price']?></span></span>
                    <span class="margin20 font_gray">解决时间：<font color="#ff6600"><?=$bestanswer['adopttime']?></font></span><span class="margin20 font_gray">回答数：<font color="#ff6600"><?=$question['answers']?></font></span><a style="cursor: pointer;" class="margin10 blue2" href="<?=SITE_URL?>?question/addfavorite/<?=$question['id']?>/<?=$question['cid']?>.html">收藏</a><a style="cursor: pointer;" class="margin10 blue2" href="javascript:inform('<?=$question['author']?>',1);">举报</a>
                    <!--问题管理开始-->
                    <? if($user['groupid']==1) { ?>                    <div id="dealQuestion">
                        <span class="boxtop1_title">问题管理</span><br>
                        <span class="blue2"><a  onclick="managequest(1);" href="javascript:void(0);">修改标题</a></span>
                        <span class="blue2"><a onclick="managequest(2);" href="javascript:void(0);">编辑内容</a></span>
                        <span class="blue2"><a onclick="managequest(3);" href="javascript:void(0);">移动分类</a></span>
                        <span class="blue2"><a onclick="managequest(5);" href="javascript:void(0);">推荐</a></span>
                        <span class="blue2"><a onclick="managequest(6);" href="javascript:void(0);">删除</a></span>
                    </div>
                    <? } ?>                    <!--问题管理结束-->
                </div>
            </div>

        </div>
        <div class="blank10"></div>
        <!--左栏 问题 结束-->
        <div id="divGoodanswer">
            <div class="box_left_best">
                <div class="box_bestask_top">
                    <div class="boxtop1_title">最佳答案</div>
                </div>
                <div class="ask_box_sub1">
                    <div class="ask_left">
                        <a href="#?id=28960110" target="_blank">
                            <img src="<?=$bestanswer['author_avartar']?>"  alt="<?=$bestanswer['author']?>" width="51" height="51"></a><br>
                        <a href="<?=SITE_URL?>?u-<?=$bestanswer['authorid']?>.html" target="_blank" title="<?=$bestanswer['author']?>"><?=$bestanswer['author']?></a>
                    </div>
                    <div class="ask_right1">
                        <span class="answer_lou"></span>
                        <span class="ppp"><?=$bestanswer['content']?>
                            <P>
                            <div class="pj" id="pingjia">
                                <div class="pj-div" title="回答很有帮助，谢谢!"><a href="javascript:vote(<?=$question['id']?>);"><span>&nbsp;</span><b id="goods"><?=$question['goods']?></b></a></div>
                            </div>
                            </P>
                        </span>
                        <span class="ask_right1_footR">回答时间：<font color="#ff6600"><?=$bestanswer['time']?></font><a class="margin10 blue2"  href="javascript:inform('<?=$bestanswer['author']?>',2);">举报</a></span></div>
                </div>
                <div class="ganyan">
                    <h6>提问者<? if($question['hidden']) { ?>匿名<? } else { ?><a target="_blank" href="<?=SITE_URL?>?u-<?=$bestanswer['authorid']?>.html"><?=$question['author']?></a><? } ?>的感言：</h6>
                    <p><? if($bestanswer['comment']) { ?><?=$bestanswer['comment']?><? } else { ?>谢谢您的解答！<? } ?></p>
                </div>
            </div>
        </div>
        <!--我来回答 结束-->
        <div class="blank10">
        </div>
        <!--回答内容 开始-->
        <div class="ask_box" id="container">
            <div class="boxtop1">
                <div class="boxtop1_title">其他网友的回答</div>共<span class="font_orange2"><? $otheranswers=$question['answers']-1 ?><?=$otheranswers?></span>条 </div>
            <!-- 答案 begin-->
            <div id="divOtheranswer"  >
                
<? if(is_array($answerlist)) { foreach($answerlist as $index => $answer) { ?>
                <? if(!$answer['adopttime']) { ?>                <? $index++ ?>                <div class="ask_box_sub1" id="asr<?=$answer['authorid']?>">
                    <div class="ask_left">
                        <a href="<?=SITE_URL?>?u-<?=$answer['authorid']?>.html" target="_blank"><img src="<?=$answer['author_avartar']?>"  alt="<?=$answer['author']?>" width="51" height="51"></a><br>
                        <a href="<?=SITE_URL?>?u-<?=$answer['authorid']?>.html" target="_blank" title="<?=$answer['author']?>"><?=$answer['author']?></a>
                    </div>
                    <div class="ask_right1">
                        <span class="answer_lou"><?=$index?>F</span>
                        <span class="ppp" id="mc<?=$index?>"><?=$answer['content']?></span>
                        <div id="divConAsk1604936" class="ask_gai"></div>
                        <? if($user['groupid']==1) { ?>                        <div  class="ask_zhuiwen">
                            <span class="boxtop1_title">回答管理</span><br>
                            <span class="blue2"><a href="javascript:editanswer(<?=$answer['id']?>,'mc<?=$index?>');">编辑内容</a></span>
                            <span class="blue2"><a href="javascript:delanswer(<?=$answer['id']?>,<?=$question['id']?>);">删除</a></span>
                            <span class="blue2"><a href="javascript:delanswer(<?=$answer['id']?>,<?=$question['id']?>);">审核</a></span>
                        </div>
                        <? } ?>                        <div class="clear"></div>
                        <span class="ask_right1_footR">回答时间：<font color="#ff6600"><?=$answer['time']?></font><a class="margin10 blue2" href="javascript:inform('<?=$answer['author']?>',2);">举报</a></span>
                    </div>
                </div>
                <? } ?>                
<? } } ?>
            </div>
            <!-- 答案 end-->

            <div id="pagecontent" style="padding-left: 10px; padding-top: 0px; height: 60px;">
                <div id="ask_page" style="padding: 5px 0pt;">&nbsp;</div>
            </div>

        </div>
        <!--回答内容 结束-->
        <div class="blank10">
        </div>

        <!--相关已解决问题 开始-->
        <div class="box_left1">
            <div class="boxtop1">
                <div class="boxtop1_title">相关已解决问题</div>
            </div>
            
            <div class="box_left1_down">
                <ul class="wenti_xiagnguan">
                
<? if(is_array($solvelist)) { foreach($solvelist as $solve) { ?>
                    <? if($question['id'] != $solve['id']) { ?>                    <li>·<a href="<?=SITE_URL?>?q-<?=$solve['id']?>.html" title="<?=$solve['title']?>" target="_blank"><?=$solve['title']?></a><span class="font_gray"><?=$solve['answers']?>个回答</span></li>
                    <? } ?>                
<? } } ?>
                </ul>
                <!--回答内容 结束-->
            </div>
            
        </div>
        <!--相关已解决问题 结束-->
        <div class="blank10"></div>
        <!--分享 开始-->
        <div class="box_left1">
            <div class="box_left1_down" id="left2"></div>
        </div>
        <!--分享 结束-->
    </div>
    <!--内容左栏 end-->


    <!--内容右栏 begin-->
    <div class="boxthree">
        <div class="box_left_nav"></div>
        <!--网友正在问 beigin-->
        <div class="boxthree4">
            <div class="boxtop2">
                <div onmouseover="show_tabz1(21)" id="zbfa021" class="boxtop2A">网友正在问</div>
                <div class="boxtop2x"></div>
                <div onmouseover="show_tabz1(22)" id="zbfa022" class="boxtop2B">赏金求答案</div>
            </div>
            <div  id="zblia021">
                <table class="right_zhengwen" border="0" cellpadding="0" cellspacing="0" width="100%">
                    <? $nosolvelist=$this->fromcache('nosolvelist'); ?>                    
<? if(is_array($nosolvelist)) { foreach($nosolvelist as $index => $nosolve) { ?>
     <? ++$index; ?>                    <tr>
                        <td class="wid190">·<a href="<?=SITE_URL?>?q-<?=$nosolve['id']?>.html" target="_blank"><?=$nosolve['title']?></a></td>
                        <td class="wid40"><?=$nosolve['price']?></td>
                    </tr>
                    
<? } } ?>
                </table>
                <div style="text-align: right; padding-right: 5px; line-height: 22px;">
                    <a href="<?=SITE_URL?>?l-1.html" target="_blank">更多&gt;&gt;</a>
                </div>
            </div>
            <div  style="display:none;" id="zblia022">
                <table class="right_zhengwen" border="0" cellpadding="0" cellspacing="0" width="100%">
                    <? $rewardlist=$this->fromcache('rewardlist'); ?>                    
<? if(is_array($rewardlist)) { foreach($rewardlist as $index => $reward) { ?>
     <? ++$index; ?>                    <tr>
                        <td class="wid190">·<a href="<?=SITE_URL?>?q-<?=$reward['id']?>.html" target="_blank"><?=$reward['title']?></a></td>
                        <td class="wid40"><?=$reward['price']?></td>
                    </tr>
                    
<? } } ?>
                </table>
                <div style="text-align: right; padding-right: 5px; line-height: 22px;">
                    <a href="<?=SITE_URL?>?l-4.html" target="_blank">更多&gt;&gt;</a>
                </div>
            </div>
        </div>
        <!-- 网友正在问 end-->
        <!--广告位
        <div id="divAds2"></div>
        -->
        <div class="blank10">
        </div>
        <!--积分排行榜开始-->
        <div class="boxthree4">
            <div class="boxtop2">
                <div class="boxtop2A" id="zbf021" onmouseover="show_tabz(21)">达人飙升榜</div>
                <div class="boxtop2x"></div>
                <div class="boxtop2B" id="zbf022" onmouseover="show_tabz(22)">总积分榜</div>
            </div>
            <div id="zbli021">
                <table class="blue" border="0" cellpadding="0" cellspacing="0" width="100%">
                    <tr>
                        <td width="11%"></td>
                        <td width="68%"><strong>用户名</strong></td>
                        <td style="text-align: right;" width="21%"><strong>得分</strong></td>
                    </tr>
                    <? $weekuserlist=$this->fromcache('weekuserlist'); ?>                    
<? if(is_array($weekuserlist)) { foreach($weekuserlist as $index => $weekuser) { ++$index; ?>                    <tr>
                        <td><div class="boxthree4paihang1"><?=$index?></div></td>
                        <td><a  href="<?=SITE_URL?>?u-<?=$weekuser['uid']?>.html"  target="_blank"><?=$weekuser['username']?></a><a></a></td>
                        <td class="b888" style="text-align: right;"><?=$weekuser['credit1']?></td>
                    </tr>
                    
<? } } ?>
                </table>
                <div style="text-align: right; padding-right: 5px; line-height: 22px;"><a target="_blank" href="<?=SITE_URL?>?us-1.html">更多&gt;&gt;</a></div>
            </div>
            <div id="zbli022" style="display: none;">
                <table class="blue" border="0" cellpadding="0" cellspacing="0" width="100%">
                    <tr>
                        <td width="11%">　</td>
                        <td width="68%"><strong>用户名</strong></td>
                        <td style="text-align: right;" width="21%"><strong>得分</strong></td>
                    </tr>
                    <? $alluserlist=$this->fromcache('alluserlist'); ?>                    
<? if(is_array($alluserlist)) { foreach($alluserlist as $index => $alluser) { ++$index; ?>                    <tr>
                        <td><div class="boxthree4paihang1"><?=$index?></div></td>
                        <td><a  href="<?=SITE_URL?>?u-<?=$alluser['uid']?>.html"  target="_blank"><?=$alluser['username']?></a><a></a></td>
                        <td class="b888" style="text-align: right;"><?=$alluser['credit1']?></td>
                    </tr>
                    
<? } } ?>
                </table>
                <div style="text-align: right; padding-right: 5px; line-height: 22px;"><a target="_blank" href="<?=SITE_URL?>?us-0.html">更多&gt;&gt;</a></div>
            </div>
        </div>
        <!--积分排行榜结束-->
        <div class="blank10">
        </div>
    </div>
    <!--内容右栏 end-->
    <div class="clear">
    </div>
</div><? if($setting['editor_on'] ) { ?><script src="<?=SITE_URL?>js/xheditor/xheditor-zh-cn.min.js" type="text/javascript"></script><? } ?><script type="text/javascript">
    var user=null;
    $.getJSON(g_site_url+"index.php?user/ajaxheader/"+Math.random(),function(myuser){
        user=myuser;
    });

    //问题管理
    function managequest(num){
        switch(num){
            case 1:
                $.dialog({
                    id:'renametitle',
                    position:'center',
                    align:'left',
                    fixed:1,
                    width:300,
                    height:100,
                    title:'修改问题标题',
                    fnOk:function(){document.renameForm.submit();$.dialog.close('renametitle')},
                    fnCancel:function(){$.dialog.close('renametitle')},
                    content:'<div class="mainbox"><form name="renameForm"  action="<?=SITE_URL?>?question/edittitle.html" method="post" ><input type="hidden" value="<?=$question['id']?>" name="qid"/>问题标题：<br /><input type="text" name="title" value="<?=$question['title']?>" class="txt" size="45" /></form></div>'});
                break;
            case 2:
                $.dialog({
                    id:'editquesDiv',
                    position:'center',
                    align:'left',
                    fixed:1,
                    width:600,
                    title:'修改问题内容',
                    fnOk:function(){editor.getSource();document.editquescontForm.submit();$.dialog.close('editquesDiv')},
                    fnCancel:function(){$.dialog.close('editquesDiv')},
                    content:'<div>标题：<?=$question['title']?><br /><form name="editquescontForm"  action="<?=SITE_URL?>?question/editcont.html" method="post" ><textarea id="mc" name="content" style="width: 95%; padding-top: 1px; font-size: 14px;" rows="10" ><?=$question['description']?></textarea><input type="hidden"  value="<?=$question['id']?>" name="qid"/></form></div>'
                });
                editor=showeditor('mc');
                break;
            case 2:
                if(!confirm('确定删除问题？该操作不可返回！')==false){
                    document.location.href="<?=SITE_URL?>?index/default.html";
                }
                break;
            case 3:
                $.dialog({
                    id:'editcatediv',
                    position:'center',
                    align:'left',
                    fixed:1,
                    width:300,
                    height:100,
                    title:'移动分类',
                    fnOk:function(){document.askform.submit();$.dialog.close('editcatediv')},
                    fnCancel:function(){$.dialog.close('editcatediv')},
                    content:'<div class="mainbox">请选择要移动到的分类：<form name="askform" action="<?=SITE_URL?>?question/movecategory.html" method="post" ><input type="hidden" name="qid" value="<?=$question['id']?>" /><select name="category" size=1 style="width:240px" ><?=$catetree?></select></form></div>'  });
                break;
            case 4:
                if(!confirm('确定关闭该问题?')==false){
                    document.location.href="<?=SITE_URL?>?question/close/<?=$question['id']?>.html";
                }
                break;
            case 5:
                document.location.href="<?=SITE_URL?>?question/recommend/<?=$question['id']?>.html";
                break;
            case 6:
                if(!confirm('确定删除问题？该操作不可返回！')==false){
                    document.location.href="<?=SITE_URL?>?question/delete/<?=$question['id']?>.html";
                }
                break;
            default:
                alert("非法操作！");
                break;
        }
    }

    //管理回答
    function editanswer(aid,mcdivid){
        var mc_content=$('#'+mcdivid).html();
        if('undefined'== typeof KE) mc_content=$.trim(mc_content.replaceAll("<br>","\n"));

        $.dialog({
            id:'editanswerDiv',
            position:'center',
            align:'left',
            fixed:1,
            width:600,
            title:'修改回答',
            fnOk:function(){editor.getSource();document.editanswerForm.submit();$.dialog.close('editanswerDiv')},
            fnCancel:function(){$.dialog.close('editanswerDiv')},
            content:user.username+',您要修改的回答如下: <div><form name="editanswerForm"  action="<?=SITE_URL?>?question/editanswer.html" method="post" ><textarea id="mc" name="content" style="width: 95%; padding-top: 1px; font-size: 14px;" rows="12" cols="100" >'+mc_content+'</textarea><input type="hidden"  value="<?=$question['id']?>" name="qid"/><input type="hidden" id="ma" value="'+aid+'" name="aid"/></form></div>'

        });
        editor=showeditor('mc');

    }

    //删除回答
    function delanswer(aid,qid){
        if(confirm("确定删除该回答?")){
            document.location.href='<?=SITE_URL?>?question/deleteanswer/'+aid+'/'+qid+'.html';
        }
    }
</script>
<script type="text/javascript">
    function vote(qid){
        $.get(g_site_url+"index.php?question/ajaxgood/"+qid+"/"+Math.random(), function(flag){
            if(-1==flag){
                alert('您已评价！');
            }else{
                $('#goods').html(1+parseInt($('#goods').html()));
            }
        });
    }
    <!--用户排行切换-->
    function show_tabz1(num){
        for(i=0;i<100;i++){
            if(document.getElementById('zbfa0'+i)){
                document.getElementById('zbfa0'+i).className='boxtop2B';
                document.getElementById('zblia0'+i).style.display='none';
            }
        }
        document.getElementById('zbfa0'+num).className='boxtop2A';
        document.getElementById('zblia0'+num).style.display='block';
    }
    function show_tabz(num){
        for(i=0;i<100;i++){
            if(document.getElementById('zbf0'+i)){
                document.getElementById('zbf0'+i).className='boxtop2B';
                document.getElementById('zbli0'+i).style.display='none';
            }
        }
        document.getElementById('zbf0'+num).className='boxtop2A';
        document.getElementById('zbli0'+num).style.display='block';
    }
    function inform(name,type){
        var content = name+'的回答';
        if(type==1){
            content = name+'的提问';
        }
        $.dialog({
            id:'informDiv',
            position:'center',
            align:'left',
            fixed:1,
            width:500,
            title:'举报',
            fnOk:function(){document.informform.submit();$.dialog.close('informDiv')},
            fnCancel:function(){$.dialog.close('informDiv')},
            content:'<div style="display: block; border-bottom: 1px dotted rgb(136, 136, 136);" class="font_orange2">如果您发现不正当的内容或行为，请及时联系管理员！</div><form name="informform" action="<?=SITE_URL?>?inform/add.html" method="POST"> <div><p><strong>举报内容：</strong>'+content+'</p><p><strong>举报原因：</strong>(可多选)</p><p><input type="checkbox" name="informkind[]" value="0" />含有反动的内容</p><p><input type="checkbox" name="informkind[]" value="1" />含有人身攻击的内容</p><p><input type="checkbox" name="informkind[]" value="2" />含有广告性质的内容</p><p><input type="checkbox" name="informkind[]" value="3" />涉及违法犯罪的内容</p><p><input type="checkbox" name="informkind[]" value="4" />含有违背伦理道德的内容</p><p><input type="checkbox" name="informkind[]" value="5" />含色情、暴力、恐怖的内容</p><input type="checkbox" name="informkind[]" value="5" />含有恶意无聊灌水的内容</p></div><input type="hidden"  value="<?=$question['id']?>" name="qid"/><input type="hidden"  value="'+content+'" name="content"/><input type="hidden"  value="<?=$question['title']?>" name="title"/></from>'
        });
    }
    $(document).ready(share);
</script>
<? include template('footer'); ?>
